<?php
use GatewayClient\Gateway;
$onlineFrom = $this->existsKeyInArray('online',$_GET,'S');
$userlist = Gateway::getAllClientSessions($onlineFrom);
if($onlineFrom == 'public') {
    array_unique($userlist, SORT_REGULAR);
    foreach($userlist as $k=>$v){
        $userlist = $this->array_unset_tt($userlist, 'uid', $v['uid']);
    }
}
?>
<div class="maintop">
    当前位置：在线玩家
    <a href="javascript:;" action="<?=$basepath?>?online=<?=$onlineFrom?>" id="btn_refresh" class="mainFrame button">刷新</a>
    <? if(ISDEBUG){ ?>
        <a href="javascript:$('.debuginfo').toggle();" class="button">调试信息</a>
    <? } ?>
</div>
<div id="mainbody">
    <table width="100%" class="tablist">
        <tr class="trbg">
            <th>No.</th>
            <th>在线编号</th>
            <th>UID</th>
            <th>玩家号码</th>
            <th>玩家类型</th>
            <th>昵称</th>
            <th width="40">操作</th>
        </tr>
        <?
        //$userlist = Gateway::getAllClientSessions($formusers);
        //$userlist = Gateway::getAllClientSessions();
        // var_dump($userlist);
        /*
        foreach ($userlist as $k=>$v){
            $vs=join(',',$v); //降维,也可以用implode,将一维数组转换为用逗号连接的字符串
            $temp[$k]=$vs;
        }
        $temp=array_unique($temp); //去掉重复的字符串,也就是重复的一维数组
        foreach ($temp as $k => $v){
            $temp[$k]=explode(',',$v); //再将拆开的数组重新组装
        }
        */
        //if(is_array($userlist)) array_unique($userlist);
        $i = 1;
        foreach($userlist as $key=>$v){
            //if(!empty($v['uid']) && !$this->deep_in_array($v['uid'], $this->autosenduserlist)){
            ?>
            <tr>
                <td><?=$i?></td>
                <td><?=$key?></td>
                <td><a href="/members/members_list_edit?uid=<?=(isset($v['uid'])?$v['uid']:'-')?>" class="colorbox" title="发送站内信"><?=(isset($v['uid'])?$v['uid']:'-')?></a></td>
                <td><a href="javascript:;" action="/box/mail_push_pop?uid=<?=(isset($v['uid'])?$v['uid']:'-')?>&uno=<?=(isset($v['uno'])?$v['uno']:'-')?>" class="mainFrame" title="推送信息"><?=(isset($v['uno'])?$v['uno']:'-')?>
                        <? if(isset($v['uid']) && $this->deep_in_array($v['uid'], 'uid', $this->autosenduserlist)){ ?>
                            <i class="trygame">机</i>
                        <? } ?></a>
                </td>
                <td><?=(isset($v['usertype']) ? $this->usertype[$v['usertype']] : '-')?></td>
                <td><?=(isset($v['nickname']) ? $v['nickname'] : '-')?></td>
                <td>
                    <? if(isset($v['uid'])){ ?>
                    <a action="/members/members_list_edit?uid=<?=(isset($v['uid'])?$v['uid']:'-')?>" title="编辑" class="mainFrame button icon-edit" href="javascript:;"></a>
                    <? }else{ echo '-'; } ?>
                </td>
            </tr>
        <? $i++; }  ?>
    </table>
    <? require VIEW.'/page.view.php' ?>
</div>
<script type="text/javascript">
    $(document).ready(function(){
        $(".colorbox").colorbox({ iframe: true,width:"80%",height:"80%" });
    });
</script>
